#pragma once
#include "Pascal.h"
#include "wc3jassvm.h"
#include "hooks.h"
#include "comparators.h"
#include "handletables.h"
#include "wc3main.h"

procedure jassvm_extension_OnInit();
void jassvm_extension_main();

	struct TFuncData
	{
		Integer ArgsCount;
	};

	typedef TFuncData* TFuncTable;

String GetCodeName2(PInstance Instance, PInstruction Code);
TFuncTable GetScriptFunctions(TScriptHandle hScript);
TScriptHandle GetInstanceScriptHandle(PInstance Instance);

typedef THandleTableM<TFuncTable, TPointerComparator<TFuncTable>> TScriptToFuncTable;
typedef THandleTable<TScriptHandle> TInstanceToScriptTable;

	class TCodeIterator
	{
	public:
		PJassScript FScript;
		Integer FInstructionsCount;
		Integer FCurrentIndex;
	public:
		PInstruction GetCurrent();
		Boolean MoveNext();
		procedure Reset();
		//property Current: PInstruction read GetCurrent;
		TCodeIterator(PJassScript AScript);
		TCodeIterator GetEnumerator();
	};

	//TInstanceHandle orig_RegisterInstance (); // fastcall
	//TScriptHandle __stdcall orig_Compile (Dword ErrorCallbackParam, Dword RiskLevel); // fastcall

